package com.hnev.musicsystem;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;

public class MusicSystem{
	public ArrayList<Music> musicList;
	public void shiftTop(Music music){
		musicList.remove(music);
		musicList.add(0,music);
	}
	public void showMusics(){
		Iterator<Music> it = musicList.iterator();
		while(it.hasNext()){
			Music music=it.next();
			System.out.println(music.name);
		}
	}
 void orderBySinger(){
	 Collections.sort(musicList,new Comparator<Music>(){
		 
		 public int compare(Music o1,Music o2){
			 return o1.singer.compareTo(o2.singer);
			 
		 }
	 });
 }
 public void playTop(){
	 musicList.get(0).play();
 }
}
